home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
DJGPP
/
QDDVX102.ZIP
/
contrib
/
dvx
/
docs
/
unix2dvx.doc
< prev
Wrap
Text File
|
1993-07-15
|
6KB
|
133 lines
UNIX2DVX 07/22/92
--------
Because of the limit of eight characters on filenames in DOS ( plus a
dot and a three letter extension), it was necessary to rename some of the header
files when porting the X11R4 toolkit to DOS. DOS will normally truncate any
characters in excess of the eight character limit, and in some cases this
results in different header files resolving to the same shortened DOS name.
When porting programs from UNIX to DOS, it would be very tedious to manually
alter all the header file names in the source code, so this program was
written to automate the process.
UNIX2DVX consists of the executable (UNIX2DVX.EXE) and two ASCII text files,
changes.txt, and wrapper.txt. The first text file, changes.txt is a list
of all the header file names which have been changed, and what they have been
changed to. Any line with an exclamation point (!) as its first character
is ignored as a comment. The changes are in the format :
oldheadername : newheadername
Any whitspace on the line is ignored, and the two header names must be separated
by a colon (:). The header file names must be complete, so to replace any
occurances of X11/IntrinsicI.h, you must specify the following line,
X11/IntrinsicI.h : X11/IntrinsI.h
The default changes.txt file contains all the changes to the standard X11R4
header files, but it can be altered by the user to include any other header
files they wish.
The second file, wrapper.txt, contains the text that will be included
at the point where a header file to be replaced is found. Again, any line
preceded by an exclamation point is ignored as a comment. UNIX2DVX does
not simply do a search and replace on all the listed header files, but
instead inserts the requested text at the required points in the code.
By default, this text inserts the folowing :
#ifdef MSDOS
#include "$MSDOSNAME" /* MTP $DATE $TIME */
#else
#include "$UNIXNAME"
#endif
$MSDOSNAME and $UNIXNAME resolve to the header name to be replaced,
and its new truncated name respectively, and date and time are replaced
by the current date and time extracted from the system. With this configuration,
when compiling under DOS, simply define MSDOS at compile time. This text could
simply be replaced by :
#include "$MSDOSNAME"
This would result in a straight substitution of the header file names.
The executable (HC.EXE) upon startup, first reads in the changes file,
and checks it for simple sytax errors. This file default may be overridden
by using the parameter -c=xxx.ext. If no path or drive is specified, the current
directory is first searched, and then the directory of HC.EXE is searched.
If no extension is provided, the default ".TXT" is used. The next file read
is the wrapper text file. Again this may be overridden, using the -w=xxx.ext.
The same search conditions apply as to the changes file.
Wild cards are acceptable (*,?) in the input file spec. HC.EXE searches
through the file, looking for #include statements, and then compares their
contents to the list it read in from the changes.txt file. If it matches one,
it then
a) Checks to see if it is contained within a conditional
compiler statement already
b) Compares the text surrounding the include statement to the
wrapper insertion text read in from wrapper.txt
If both of these check out, it then inserts the appropriate text at that
position. (Note, any comments on the original line will be moved to below the
wrapper text insertion in the processed file)
Because the wrapper text may be changed by the user, trying to decide
if an include has been previously preprocessed became more tricky. I decided
that most people will stick approximately with the original wrapper.txt,
give or take a few comments. It was on this assumption that I do the comparision
between the wrapper text and the lines surrounding the #include in the source
file being preprocessed. I first remove all white space from the line, and
then remove any comments before comparing the lines.
When preprocessing is finished, the original file is renamed to a .BAK (in
case you require it). All changes and warnings are written to stdout, and
so may be redirected to a file.
Command line switches
---------------------
(Note : all switches may begin with either a '/' or a '-',
they are not case sensitive, and may appear in any position
and order on the command line)
-?
-h[elp]
Provides a list of all switches and a brief description
of each.
-c=xxx.ext
Selects new changes file. (discussed above)
-w=xxx.ext
Selects new wrapper file. (discussed above)
-l
Lists to screen the changes that would be made,
does not alter the input file.
-i
Ignore Case. This will affect the comparisons
between the header files in the source, and the list of files
to be replaced in changes.txt (e.g. x11/IntrinsicI.h and
X11/IntrinsicI.h will not match normally - they will with
this option.) This also affects the comparsion between
the wrapper text and the source file.
-nw
No Wrapper check. UNIX2DVX will not compare the wrapper text
to the lines surrounding the #include in the source, to see if
it has been previously preprocessed.
-d=val
Set allowed depth of nested ifdefs. Normally, this defaults
to zero, meaning if an header file which should be replaced
is contained within a conditional statement, it will not be
replaced. In some modules, and header files, this may
need to be changed, because the entire code could
be contained within an ifdef statement.